<template>
  <div>
    <div>
      <van-nav-bar
        title="新闻管理"
        left-text="返回"
        right-text="发送新闻"
        left-arrow
        @click-left="onClickLeft"
        @click-right="onClickRight"
      />
    </div>
    <!--  -->
    <div>
      <div class="top100" align="left" v-for="(item, i) in news_list" :key="i">
        <van-row>
          <van-col span="16">
            {{ item.title }} <br />
            <font size="2" color="aaaaaa">{{ item.value }}</font>
          </van-col>
          <van-col span="8">
            <div align="right">
              <div v-if="item.status == 1"><van-tag size=large color="#ffe1e1" text-color="#ad0000" type="success">已通过审核</van-tag>&emsp;</div>
              <div v-if="item.status == 2"><van-tag size=large type="danger">未通过审核</van-tag>&emsp;</div>
              <div v-if="item.status == 0"><van-tag size=large type="warning">未审核</van-tag>&emsp;&emsp;</div>
            </div>
          </van-col>
        </van-row>
        <hr />
      </div>
    </div>
    <!--  -->
    <div></div>
    <!--  -->
    <div></div>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      news_list: [],
    };
  },
  props: {},

  components: {},

  created() {},

  mounted() {
    this.newsDataGet();
  },

  methods: {
    onClickLeft() {
      this.$router.push("/");
    },
    // 获取该用户的新闻
    newsDataGet() {
      this.axios.get("/news/user", {params: {'user_id': localStorage.user_id}}).then((res) => {
        console.log("获取新闻的响应:", res);
        this.news_list = res.data.list;
      });
    },
    onClickRight(){
        this.$router.push('/post/news')
    }
  },

  computed: {},

  watch: {},

  directives: {},

  filters: {},
};
</script>

<style scoped >
* {
  margin: 0;
}
.top100 {
  margin: 15px;
}
</style>
